<template>
    <div>
        <div class="scroll-row d-flex a-center j-center h-37">
            <van-uploader v-model="fileList" :after-read="afterRead">
                <template #preview-cover="{ file }">
                    <div class="preview-cover van-ellipsis">{{ file.name }}</div>
                </template>
            </van-uploader>
        </div>
    </div>
</template>

<script>
import { outSuccess } from '@/https/Commit'

export default {
    data() {
        return {
            fileList: []
        }
    },
    methods: {
        afterRead(file) {
            file.status = 'uploading'
            file.message = '上传中...'

            setTimeout(() => {
                outSuccess(file)
                    .then((res) => {
                        console.log(res)
                        this.$router.push('/CommodityMan')
                    })
                    .catch((err) => {
                        console.log(err)
                    })
            }, 2000)
        }
    }
}
</script>

<style lang="scss" scoped></style>
